<?php

namespace App\Models\Admin;

use App\Http\Controllers\Admin\Traits\AdminTrait;
use App\Log\CompanyLog;
use Illuminate\Database\Eloquent\Model;

class School extends Base
{
    const OPERATE_PID = 1;
    const MODEL = 'school';

    use AdminTrait;
    protected $table = 'school';
    protected $guarded = [];
    protected $dateFormat = 'U';



    // 添加操作日志
    public static function addLog($pre,$next,$type,$method='')
    {
        $info = AdminOperateModule::where('pid',self::OPERATE_PID)->where('type',$type)->where('model',self::MODEL)->when($method,function ($query)use ($method){
            $query->where('method',$method);
        })->first();
        if (!empty($info)){
            $adminLog = new CompanyLog($pre,$next,$info);
            $adminLog->addLog();
        }
    }
}
